Skip to content

Improve emoji stripping regex#2415

Open
wrefgtzweve wants to merge 2 commits intoFacepunch:masterfrom
wrefgtzweve:patch-5
Open

Improve emoji stripping regex#2415
wrefgtzweve wants to merge 2 commits intoFacepunch:masterfrom
wrefgtzweve:patch-5

Conversation

@wrefgtzweve
Copy link
Contributor

Improves the emoji filtering server browser code to properly filter all emojis as some are able to pass through right now
Example:

function StripWeirdSymbolsOld( name )
{
	// Weird symbols
	var ret = name.replace( /[\u2100-\u23FF\u2580-\u259F\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]/g, "" );

	// Emojis
	ret = ret.replace( /\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|\uD83E[\uDD10-\uDFFF]/g, "" );
	return ret;
}

function StripWeirdSymbolsNew( name )
{
	// Weird symbols
	var ret = name.replace( /[\u2100-\u23FF\u2580-\u259F\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]/g, "" );

	// Emojis
    ret = ret.replace( /([\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF])/g, "" );
    return ret;
}

let ret = "EMOJIRP | 50K 👋 🤌 🚀| COOL 🌍 | ❤🤏🤎 ™ © RP!";
console.log("original: " + ret);
console.log("old: " + StripWeirdSymbolsOld( ret ));
console.log("new: " + StripWeirdSymbolsNew( ret ));
original: EMOJIRP | 50K 👋 🤌 🚀| COOL 🌍 | ❤🤏🤎 ™ © RP!
old: EMOJIRP | 50K  🤌 | COOL  | 🤏🤎  © RP!
new: EMOJIRP | 50K   | COOL  |   © RP!

@FrankPye1
Copy link

FrankPye1 commented Jan 6, 2026

You clearly are a 50 year old linux user, Please stop coming to the house party and telling everyone to go home L #JusticefromEmojis

@robotboy655 robotboy655 added the Enhancement The pull request enhances current functionality. label Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement The pull request enhances current functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants